package org.wiztools.oembed;

/**
 * Defines the types (photo, video, link, rich) supported by oEmbed specification.
 * @author subhash
 */
public enum OEmbedType {
    PHOTO, VIDEO, LINK, RICH;

    private final static String photo = "photo";
    private final static String video = "video";
    private final static String link = "link";
    private final static String rich = "rich";
    
    public static OEmbedType get(final String type) {
        switch(type) {
            case photo:
                return PHOTO;
            case video:
                return VIDEO;
            case link:
                return LINK;
            case rich:
                return RICH;
            default:
                throw new IllegalArgumentException("<type> not valid as per specification: " + type);
        }
    }
    
    @Override
    public String toString() {
        switch(this) {
            case PHOTO:
                return photo;
            case VIDEO:
                return video;
            case LINK:
                return link;
            case RICH:
                return rich;
        }
        throw new IllegalStateException("Will never come here!");
    }
}
